<?php
/*
 *---------------------------------------------------------------
 * ROOT DIRECTORTY
 *---------------------------------------------------------------
 * Change root directory on this
 */
chdir(dirname(__FILE__));


/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT ENUMERATIONS
 *---------------------------------------------------------------
 */
define('ENVIRONMENT_DEVELOPMENT', E_ALL);
define('ENVIRONMENT_TEST',       (E_ERROR | E_WARNING | E_PARSE));
define('ENVIRONMENT_PRODUCTION',  FALSE);


/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 */
define('ENVIRONMENT', ENVIRONMENT_DEVELOPMENT);


/*
 *---------------------------------------------------------------
 * PHP ERROR REPORTING
 *---------------------------------------------------------------
 */
error_reporting(ENVIRONMENT);


/*
 *---------------------------------------------------------------
 * COMMANDLINE
 *---------------------------------------------------------------
 */
if (! empty($argv))
{
	define('CLI', TRUE);
	
	global $argv;
	global $argc;
}	


/*
 *---------------------------------------------------------------
 * RENARTI DEFINES
 *---------------------------------------------------------------
 * defines that can be different between CLI and Web
 */
if(defined('CLI')) // if application was runned from command line
{
	define ('INDEX',     basename(__FILE__));	
	define ('DOCROOT',   realpath('./'));	
	define ('SUBFOLDER', '/');	
	define ('HTTPHOST',  '127.0.0.1' . SUBFOLDER);
}
else // applicatinon was runned from web server
{
	define ('INDEX',     basename(__FILE__));	
	define ('DOCROOT',   $_SERVER['DOCUMENT_ROOT']);	
	define ('SUBFOLDER', str_replace(basename(__FILE__), '', $_SERVER['SCRIPT_NAME']));	
	define ('HTTPHOST',  $_SERVER['HTTP_HOST'] . SUBFOLDER);
}

define ('APPPATH',   DOCROOT . SUBFOLDER .'application/');	
define ('SYSPATH',   DOCROOT . SUBFOLDER. 'system/');


	
/*
 * --------------------------------------------------------------------
 * LOAD THE RENARTI FILE
 * --------------------------------------------------------------------
 * let`s play ...
 */
require_once SYSPATH . 'Rti.php';

Rti::application()->run();

exit();

/* End of file index.php */